<?php

    function is_logged_in(){
        $ci = &get_instance();
        return ($ci->session->userdata("logged_in"));
    }
    
    function get_user(){
        if (is_logged_in()){
            $ci = &get_instance();
            $user->username = $ci->session->userdata("username");
            return $user;
        }
    }
    
    function is_medico(){
        $ci = &get_instance();
        if (is_logged_in()){
            $username = $ci->session->userdata("username");
            $letter = substr($username, 0, 1);
            return $letter=="m";
        } else {
            return false;
        }
    }
    
    function get_menu($key){
        $ci = &get_instance();
        $menu = $ci->config->item("e-farmacia-menu");
        return $menu[$key];
        
    }

?>